home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
BASIC
/
3940.ZIP
/
PWEZ.ZIP
/
MULTSAM3.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-06-01
|
5KB
|
109 lines
'***************************************************************************
' This is an example of using a field in MULTINPT as a FIXED CHOICE ****
' field. Field two provides the choices of BASIC, PASCAL, OR ASSEMBLY. ****
'***************************************************************************
'**** THIS PROGRAM MUST BE USED WITH ONE OF THE FOLLOWING LIBRARIES: ****
'***************************************************************************
'**** For QB4.5 unenhanced version use QBUNEN.QLB ****
'**** For BASIC 7.1 unenhanced version use PDSUNEN.QLB ****
'**** For VBDOS 1.0 unenhanced version use VBUNEN.QLB ****
'**** For QB4.50 enhanced version use QBALL.QLB or QBNER.QLB ****
'**** For BASIC 7.1 enhanced version use PDSALL.QLB or PDSNER.QLB ****
'**** For VBDOS 1.0 enhanced version use VBALL.QLB or VBNER.QLB ****
'**** Load QB, QBX, or VBDOS with the /L option and the correct library ****
'***************************************************************************
DECLARE SUB PRINTINFO (I$)
DECLARE SUB INFOLINE (INTR%, INLC%, INWD%, INATTR%)
DECLARE SUB BOXW (TR%, LC%, WD%, NR%, BORDER%)
DECLARE SUB UPDATEFIELD (SCRN%, FLD%, TEXT$)
DECLARE SUB INPTINIT (DTYPE%, ISDOT%, AT1%, BLNK%, MS%)
DECLARE SUB MAKEFIELD (SCRN%, FLD%, SCODE%, STR%, SLC%, SWD%, SBASEATTR%, SACTATTR%, MATTR%, RES$, EXTO$, HOTPOS%, CURPOS%, BRACKET%)
DECLARE SUB MULTINPT (S%, TOFLD%, OPTION$, FF%, RKEY%, RTRN$(), SF%)
DECLARE SUB SETINPT (SCRN%, DISPLAYLEN%, EXIT$, HOTCOL%)
DECLARE SUB MAKEWIND (W%, LABEL$, TR%, LC%, WD%, NR%, ATTR%, BORDER%)
DECLARE SUB PRINTW (TEXT$, R%, LC%)
DECLARE SUB SETWIND (FST%, S%, SH%, NH%, BRKT%)
DECLARE FUNCTION MOUSEON% (ISON%)
'***************************************************************************
CALL SETWIND(1, 1, 7, 0, 15) ' INITIALIZE WINDOW MEMORY
CALL INPTINIT(1, 1, 1, 1, 1) ' INITIALIZE INPUT MEMORY
JUNK% = MOUSEON%(1)
CALL INFOLINE(16, 2, 78, 15)
COLOR 7, 0: CLS ' BLANK THE SCREEN
DIM RTRN$(6) ' For the six fields/buttons
'---------------------------------------------------------------------------
' SETINPT MUST BE CALLED FOR EACH MULTI-FIELD INPUT SCREEN
CALL SETINPT(1, 25, "E", 127)
FOR X% = 1 TO 4
READ CODE%, TR%, LC%, WD%
CALL MAKEFIELD(1, X%, CODE%, TR%, LC%, WD%, 15, 15, 15, "", "", 0, 1, 0)
NEXT
' Auto-exit - auto advance - numeric with no decimal places
DATA 11000,5,5,4 : 'FIELD 1
' Auto-exit - auto advance - numeric with no decimal places
DATA 11000,7,5,4 : 'FIELD 2
' Protected - numeric with no decimal places
DATA 100,9,5,5 : 'FIELD 3
' Alpha / numeric
DATA 10007,11,5,15 : 'FIELD 4
' Make the OK and CANCEL button fields
MAKEFIELD 1, 5, 30007, 14, 13, 6, 112, 15, 15, "", "", 0, 3, 1
RTRN$(5) = "< OK >"
MAKEFIELD 1, 6, 30007, 14, 58, 10, 112, 15, 15, "", "", 0, 3, 1
RTRN$(6) = "< CANCEL >"
'----------------------------------------------------------------------------
' MAKE A WINDOW. PRINT INSTRUCTIONS
CALL MAKEWIND(1, "@Using the info-line to print instructions - All field must be AUTOEXIT.", 1, 1, 80, 17, 112, 102)
CALL PRINTW("Auto-exit and auto advance with numeric input", 2, 15)
CALL PRINTW("+", 3, 5)
CALL PRINTW("Auto-exit and auto advance with numeric input", 4, 15)
CALL PRINTW("Protected Field", 6, 15)
CALL PRINTW("Alpha-numeric", 8, 24)
CALL PRINTW("-------- Button fields ---------", 11, 23)
CALL BOXW(10, 8, 14, 3, 2)
CALL BOXW(10, 55, 14, 3, 2)
'----------------------------------------------------------------------------
TOFLD% = 1: FROMFLD% = 0 ' START IN FIELD 1. PRINT ALL
' FIELDS.
'----------------------------------------------------------------------------
DO
SELECT CASE TOFLD% ' Set and print instructions
CASE 1
I$ = " Input the first number"
CASE 2
I$ = " Input the second number"
CASE 4
I$ = " Input anything!!!"
CASE 5, 6
I$ = " Press ENTER, SPACE BAR or CLICK with mouse to select."
END SELECT
CALL PRINTINFO(I$) ' Print instructions in info-line
'----------------------------------------------------------------------------
CALL MULTINPT(1, TOFLD%, "U", FROMFLD%, RKEY%, RTRN$(), SELECTION%)
IF FROMFLD% = 1 OR FROMFLD% = 2 THEN ' IS IT FIELD 1 OR 2 ?
RTRN$(3) = STR$(VAL(RTRN$(1)) + VAL(RTRN$(2))) ' ADD FIELD 1 + 2
IF RTRN$(1) + RTRN$(2) = "" THEN RTRN$(3) = ""
CALL UPDATEFIELD(1, 3, RTRN$(3)) ' UPDATE FIELD 3 ONLY
END IF
' Make mouse release on OK and CANCEL same a ENTER
IF TOFLD% > 4 AND RKEY% = 100 THEN FROMFLD% = TOFLD%: RKEY% = 13
' Make ESC same as ENTER on CANCEL
IF RKEY% = 27 THEN FROMFLD% = 6: RKEY% = 13
' Do until OK or CANCEL selection is made via MOUSE, SPACE BAR or ENTER
LOOP UNTIL FROMFLD% > 4 AND (RKEY% = 13 OR RKEY% = 32)
' OK or CANCEL selected
LOCATE 19, 1
IF FROMFLD% = 5 THEN PRINT "OK EXITED" ELSE PRINT "CANCEL/ESC EXITED"